desc "annotate-rails task"
task 'annotate-rails' do
  require 'annotated/models'
  Annotated::Models.instance.annotate!(options={})
end

%w[
  db:migrate
  db:rollback
  db:forward
].each do |db_schema_change_task|
  if Rake::Task.task_defined? db_schema_change_task
    # "after-hook"
    task db_schema_change_task do
      Rake::Task['annotate-rails'].invoke
    end
  end
end
